home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr48 / ppascal.zip / SPIRAL2.PAS < prev    next >
Pascal/Delphi Source File  |  1993-04-24  |  1KB  |  39 lines

  1. program spiral2;
  2.   { makes a really neeto spiral of a random color }
  3.  
  4. uses
  5.   Crt, Graph;
  6. const
  7.   width          = 3;        { width of the line: 1 = narrow, 3 = wide }
  8.   finalDiam      = 2000;     { the final diameter of the spiral        }
  9.   betweenWidth   = 70;        { distance between the lines (inverse)    }
  10.   startingradius = 1;        { initial spiral radius                   }
  11. var
  12.   graphDriver,
  13.   ErrorCode,
  14.   GraphMode   : integer;
  15.   radius      : integer;
  16.   x           : integer;
  17.   ch          : char;
  18. begin
  19.   graphdriver := detect;
  20.   InitGraph( Graphdriver, GraphMode, 'c:\utils\tp');
  21.   ErrorCode := Graphresult;
  22.   if errorcode <> grOk then halt(1);
  23.   randomize;
  24.   setcolor ( random (getmaxColor - 1 ) + 1 );  {sets color of spiral }
  25.   setlinestyle( 0, 0, width);
  26.   x := 0;
  27.   radius := startingradius;
  28.   repeat
  29. {    sound(radius+100);}
  30.     arc ( 320, 240, x, x+betweenwidth, radius );
  31.     inc ( x, betweenwidth );
  32.     inc ( radius );
  33.     if x = 360 then x := 0;
  34.   until ( radius = finaldiam ) or ( keypressed);
  35.   if keypressed then ch := readkey;
  36.   nosound;
  37.   ch := readkey;
  38.   closegraph;
  39. end.